import type { Dayjs } from 'dayjs';

export interface SearchInfo {
	userId?: number;
	membershipId?: number;
	startTime?: Dayjs | string;
	endTime?: Dayjs | string;
	memberNumber?: string; // 会员号
	userCode?: string; // 用户编码
	phone?: string; // 手机号
	gender?: string; // 性别
	region?: string[]; // 地域
	ageMin?: number; // 年龄段开始
	ageMax?: number; // 年龄段结束
	heightMin?: number; // 身高开始
	heightMax?: number; // 身高结束
	weightMin?: number; // 体重开始
	weightMax?: number; // 体重结束
	profession?: string; // 职业
	incomeStatus?: string; // 收入结束
	maritalStatus?: string; // 婚姻状况
	carHouseStatus?: string; // 车房情况
}

export interface pageInfo {
	current?: number;
	pageSize?: number;
	total?: number;
	showTotal: Function;
	showSizeChanger: boolean;
	pageSizeOptions: string[];
	showSizeChange: Function;
	size: string;
	showQuickJumper: boolean;
	defaultPageSize: number;
}

export let pagination = ref<any>({
	// 数据总数
	total: 0,
	// 当前页数
	current: 1,
	// 每页条数
	pageSize: 10,
	// 展示总数
	showTotal: (total: number) => `共 ${total} 条`,
	// 是否可以改变pageSize
	showSizeChanger: true,
	// 设置每页可以展示多少条的选项
	pageSizeOptions: ['10', '20', '50', '100'],
	// 改变pageSize后触发
	showSizeChange: (current: number, pageSize: any) => (
		(pagination.value.current = current),
		(pagination.value.pageSize = pageSize)
	),
	// 小尺寸分页
	size: 'small',
	// 是否可以快速跳转至某页
	showQuickJumper: true,
	//默认条数
	defaultPageSize: 10,
});

export const columns = ref<any>([
	{
		title: '用户编码',
		dataIndex: 'code',
		key: 'code',
		width: 120,
	},
	{
		title: '昵称',
		dataIndex: 'nickname',
		key: 'nickname',
		width: 120,
	},
	{
		title: '会员开始时间',
		dataIndex: 'startTime',
		key: 'startTime',
		width: 140,
	},
	{
		title: '会员结束时间',
		dataIndex: 'endTime',
		key: 'endTime',
		width: 140,
	},
	{
		title: '身份证姓名',
		dataIndex: 'realName',
		key: 'realName',
		width: 120,
	},
	{
		title: '身份证号码',
		dataIndex: 'idCard',
		key: 'idCard',
		width: 180,
	},
	{
		title: '手机号',
		dataIndex: 'phone',
		key: 'phone',
		width: 140,
	},
	{
		title: '性别',
		dataIndex: 'gender',
		key: 'gender',
		width: 80,
	},
	{
		title: '地域',
		dataIndex: 'region',
		key: 'region',
		width: 120,
	},
	{
		title: '年龄',
		dataIndex: 'age',
		key: 'age',
		width: 80,
	},
	{
		title: '身高(cm)',
		dataIndex: 'height',
		key: 'height',
		width: 100,
	},
	{
		title: '体重(kg)',
		dataIndex: 'weight',
		key: 'weight',
		width: 100,
	},
	{
		title: '年收入',
		dataIndex: 'income',
		key: 'income',
		width: 120,
	},
	{
		title: '职业',
		dataIndex: 'profession',
		key: 'profession',
		width: 240,
	},
	{
		title: '婚姻状况',
		dataIndex: 'maritalStatus',
		key: 'maritalStatus',
		width: 100,
	},
	{
		title: '车房情况',
		dataIndex: 'carHouseStatus',
		key: 'carHouseStatus',
		width: 120,
	},
	{
		title: '状态',
		dataIndex: 'memberFlag',
		key: 'memberFlag',
		width: 100,
	},
	{
		title: '会员类型',
		dataIndex: 'membershipName',
		key: 'membershipName',
		width: 120,
	},
	{
		title: '办理时间',
		dataIndex: 'operateTime',
		key: 'operateTime',
		width: 140,
	},
	{
		title: '操作',
		key: 'operation',
		fixed: 'right',
		width: 120,
	},
]);

export interface DataItem {
	userId: number;
	membershipId: number;
	startTime?: Dayjs | string;
	endTime?: Dayjs | string;
}

export interface ModelInfo {
	title?: string;
	width?: string;
	id?: number | undefined;
	confirmLoading?: boolean;
}

export interface dictInfo {
	typeCode?: string | number | undefined;
	typeName?: string | undefined;
}
